﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefLMESBadCodeTemplate" :model="stateLMESBadCodeTemplate.vmModel" label-width="100px">
    <div style="margin-bottom:10px;">{{$t('message.autotrans.SysBatchEditConfirm')}}</div>
    <el-row>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_LMESBadDescription_FormItem" prop="LinkedVM.LMESBadDescription" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_LMESBadDescription')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_LMESBadCodeTemplate_LMESBadDescription')}), trigger: 'blur' }]" >
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.LMESBadDescription" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OperationCode_FormItem" prop="LinkedVM.OperationCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_OperationCode')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.OperationCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_BadCode_FormItem" prop="LinkedVM.BadCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadCode')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.BadCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_BadName_FormItem" prop="LinkedVM.BadName" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadName')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.BadName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_BadTypeCode_FormItem" prop="LinkedVM.BadTypeCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadTypeCode')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.BadTypeCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_BadTypeName_FormItem" prop="LinkedVM.BadTypeName" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadTypeName')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.BadTypeName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_AddTime_FormItem" prop="LinkedVM.AddTime" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_AddTime')">
          <el-date-picker v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.AddTime" type='date' clearable></el-date-picker>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_DataStatus_FormItem" prop="LinkedVM.DataStatus" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_DataStatus')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.DataStatus" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_EditTime_FormItem" prop="LinkedVM.EditTime" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_EditTime')">
          <el-date-picker v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.EditTime" type='date' clearable></el-date-picker>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_EnableStatus_FormItem" prop="LinkedVM.EnableStatus" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_EnableStatus')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.EnableStatus" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_FactoryCode_FormItem" prop="LinkedVM.FactoryCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_FactoryCode')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.FactoryCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Field1_FormItem" prop="LinkedVM.Field1" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field1')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.Field1" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Field2_FormItem" prop="LinkedVM.Field2" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field2')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.Field2" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Field3_FormItem" prop="LinkedVM.Field3" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field3')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.Field3" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Field4_FormItem" prop="LinkedVM.Field4" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field4')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.Field4" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Field5_FormItem" prop="LinkedVM.Field5" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field5')">
          <el-input v-model="stateLMESBadCodeTemplate.vmModel.LinkedVM.Field5" clearable></el-input>
      </el-form-item>

      </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitLMESBadCodeTemplate"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

      <WtmButton @click="onCloseLMESBadCodeTemplate"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

    </div>

  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageBaseInformationLMESBadCodeTemplateBatchEdit;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { lmesbadcodetemplateApi } from '/@/api/baseinformation/lmesbadcodetemplate';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefLMESBadCodeTemplate = ref();
const stateLMESBadCodeTemplate = reactive({
    vmModel: {
	  LinkedVM:{
        LMESBadDescription: '',
        OperationCode: '',
        BadCode: '',
        BadName: '',
        BadTypeCode: '',
        BadTypeName: '',
        AddTime: undefined,
        DataStatus: '',
        EditTime: undefined,
        EnableStatus: '',
        FactoryCode: '',
        Field1: '',
        Field2: '',
        Field3: '',
        Field4: '',
        Field5: '',
      },
      Ids:[],
      
	},
    
});

// 取消
const onCloseLMESBadCodeTemplate = () => {
    closeDialog();
};

// 提交
const onSubmitLMESBadCodeTemplate = () => {
	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});

    formRefLMESBadCodeTemplate.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            lmesbadcodetemplateApi().batchedit(stateLMESBadCodeTemplate.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error:any) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};


// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateLMESBadCodeTemplate.vmModel.Ids = ci.attrs["wtmdata"];
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateLMESBadCodeTemplate.vmModel.Ids = useRouter().currentRoute.value.query.id as any;
	}

});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

